<%@page language="java" pageEncoding="UTF-8"%>
<!DOCTYPE html>
<html class="root61">
<head>
<%@include file="/views/common/include/taglib.jsp"%>
<%@include file="/views/common/include/head.jsp"%>
<link type="text/css" rel="stylesheet" href="${ctx }/css/dlifestyle/sectionparent.css" source="widget" />
<link type="text/css" rel="stylesheet" href="${ctx }/css/dlifestyle/admin.css" source="widget" />
<link type="text/css" rel="stylesheet" href="${ctx}/css/dlifestyle/table.css" />
<script src="${ctx}/js/controllers/base/commonconfig/ConfigEditForPropertyController.js" type="text/javascript"></script>

</head>
<body style="margin: 0px">
    <section>
        <div style="height: 40px; line-height: 40px;">
            <div class="forword_area"></div>
            <div class="location">当前位置：${sessionScope.currcent_position}</div>
        </div>
        <hr>
        <div class="panel panel-default">
            <div class="editTitle">
                <div style="height: 41px; width: 190px; float: left;">
                    <img style="float: left; margin-left: 37px; margin-top: 9.5px;" src="${ctx}/images/new_edit.png" />
                    <h4>编辑配置信息</h4>
                </div>
                <div>
                    <a style="float: right; margin-right: 20px; margin-top: -2px;" title="关闭" onclick="cancel();"><img src="${ctx}/images/new_close.png" /></a>
                </div>
            </div>

            <div id="form" class="form" style="height: auto;">
                <div class="itemEdit">
                    <label class="col-sm-1 editlableEdit">描述：</label>
                    <div class="fl">
                        <input id="configId" type="hidden" value="${config.id}"> <input class="editform-control" id="label" type="text" value="${config.label}" class="text" maxlength="25"
                            placeholder="请输入单元名" /> <em class="emStyle">*</em>
                    </div>
                </div>
                <div class="itemEdit">
                    <label class="col-sm-1 editlableEdit">名称：</label>
                    <div class="fl">
                        <input class="editform-control" type="text" value="${config.name}" class="text" maxlength="25" readonly placeholder="请输入单元名" />
                    </div>
                </div>
                <div class="itemEdit">
                    <input id="unitCellId" type="hidden" value="${config.cellId}"> <label class="col-sm-1 editlableEdit">小区名：</label>
                    <div class="fl">
                        <select class="editform-control" style="height: 29px; width: 207px;" id="cellId" disabled="disabled">
                            <option value="">小区</option>
                            <c:forEach items="${cellInfos}" var="item" varStatus="cStatus">
                                <option id="${item.id}" value="${item.id}" <c:if test="${item.id == config.cellId}">selected="selected"</c:if>>${item.cellName}</option>
                            </c:forEach>
                        </select> <em class="emStyle">*</em>
                    </div>
                </div>
                <%-- <div class="itemEdit">
                    <label class="col-sm-1 editlableEdit">单位：</label>
                    <div class="fl">
                        <input class="editform-control" type="text" id="unit" value="${config.unit}" class="text" maxlength="25" readonly placeholder="请输入单元名" />
                    </div>
                </div> --%>
                <div class="itemEdit">
                    <span class="col-sm-1 editlableEdit">备注：</span>
                    <div class="fl">
                        <input class="editform-control" id="memo" type="text" maxlength="50" value="${config.memo}">
                    </div>
                </div>
                 <c:if test="${editType == 3}">
                 <input id="editType" type="hidden" value="${editType}"/>
                <div class="itemEdit">
                    <span class="col-sm-1 editlableEdit">值：</span>
                    <div class="fl">
                        <input class="editform-control" id="configValue" type="text" maxlength="20" value="${config.value}" onkeyup = "checInputNum(this)" onblur="checkValue();">
                    </div>
                </div>
                </c:if>
                <c:if test="${editType == 2}">
                 <input id="editType" type="hidden" value="${editType}"/>
                <div class="itemEdit">
                    <span class="col-sm-1 editlableEdit">值：</span>
                    <div class="fl">
                        <input class="editform-control" id="configValue" type="text" maxlength="20" value="${config.value}" onkeyup = "checInputNum(this)">
                    </div>
                </div>
                </c:if>
                <c:if test="${editType == 1}">
                 <input id="editType" type="hidden" value="${editType}"/>
                    <div class="itemEditUeditor" style="min-height:400px;height:auto;">
                    <span class="col-sm-1 editlableEditUeditor">值：</span>
                    <div id="ueditor" class="flEdit" style="text-align: left; line-height: 20px;">
                        <!-- <textarea name="content" id="ideaContent" style="width:537px;height:100px;resize:none" class="itxt" maxlength="200" required></textarea> -->
                        <!-- 加载编辑器的容器 -->
                        <script id="container" style="margin-top: 10px;" type="text/plain">${config.value }</script>
                        <!-- 配置文件 -->
                        <script type="text/javascript" src="${ctx }/js/lib/ueditor/ueditor.config.js"></script>
                        <!-- 编辑器源码文件 -->
                        <script type="text/javascript" src="${ctx }/js/lib/ueditor/ueditor.all.js"></script>
                        <script type="text/javascript" src="${ctx }/js/lib/ueditor/ueditor.parse.js"></script>
                        <!-- 实例化编辑器 -->
                        <script type="text/javascript">
                                var ue = UE.getEditor('container',{
                                    toolbars : [
                                                  ['fontfamily','fontsize', '|', 'blockquote', 'horizontal', '|', 'removeformat', '|', 'insertimage'],
                                                  ['bold', 'italic', 'underline', 'forecolor', 'backcolor', '|',
                                                   'justifyleft', 'justifycenter', 'justifyright', '|',
                                                   'rowspacingtop', 'rowspacingbottom', 'lineheight', '|',
                                                   'insertorderedlist', 'insertunorderedlist', '|',
                                                   'imagenone', 'imageleft', 'imageright', 'imagecenter','autotypeset','cleardoc','source'
                                                   ]
                                                ],
                                    UEDITOR_HOME_URL: '${ctx}/js/lib/ueditor/',
                                    serverUrl: '${ctx}/fileHandler/upLoaderMergeForUeditor',
                                    imageUrlPrefix: '${sessionScope.image_logo}',
                                    imageActionName: 'uploadimage',
                                    imageFieldName: 'file',
                                    imageMaxSize: 1024000,
                                    imageAllowFiles: ['.png', '.jpg', '.jpeg', '.gif'],
                                    initialFrameHeight: 200,
                                    elementPathEnabled: false,
                                    retainOnlyLabelPasted:true,
                                    wordCount: false,
                                    /* sourceEditor: 'textarea', */
                                    insertorderedlist: {
                                        // 系统自带
                                        'decimal': '',     // '1,2,3...'
                                        'lower-alpha': '', // 'a,b,c...'
                                        'lower-roman': '', // 'i,ii,iii...'
                                        'upper-alpha': '', // 'A,B,C'
                                        'upper-roman': ''  // 'I,II,III...'
                                    },
                                    insertunorderedlist : {
                                        // 系统自带
                                        'circle': '',  // '○ 小圆圈'
                                        'disc': '',    // '● 小圆点'
                                        'square': ''   // '■ 小方块'
                                    },listDefaultPaddingLeft : '50'});
                   </script>
                    </div>
                </div>
                        </c:if>
                <div class="foot" style="z-index :1;">
                    <button class="buttonCancle" onclick="cancel();">取&nbsp;&nbsp;消</button>
                    <button class="buttonEdit" onclick="saveConfig();">保&nbsp;&nbsp;存</button>
                </div>
            </div>
        </div>
    </section>

    <script type="text/javascript">
                    var ctx = '${ctx}';
                    setCtx(ctx);

                    //动态获取图文混排编辑器的宽度
                    $(function() {
                        var width = document.getElementById("form").offsetWidth;
                        $("#container").css("width", (width - 250));
                    });

                    //返回上一页
                    function cancel() {
                        parent.loadContent("/commonConfig/infoListForProperty");
                    }
                </script>
    <!-- 解决ie 6 7 8 9不能显示placeholder的问题 -->
    <script src="${ctx}/js/lib/jquery.JPlaceholder.js"></script>
</body>
</html>
